package com.example.muasic.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.muasic.R;
import com.example.muasic.info.item;

import java.util.List;

public class myAdapter extends BaseAdapter {
    private Context mContext;
    private List<item> List;
    Button buttonbj;
    public myAdapter(Context context, List<item> list){
        mContext = context;
        List = list;
    }

    @Override
    public int getCount() {
        return List.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = LayoutInflater.from(mContext).inflate(R.layout.item,null);
        TextView functionName = view.findViewById(R.id.functionName);
        ImageView functionIcon = view.findViewById(R.id.functionIcon);
        int[] iconItem = {R.drawable.lay_icn_upquality, R.drawable.lay_icn_artist,
                R.drawable.lay_icn_dld, R.drawable.lay_icn_alb, R.drawable.lay_icn_fav};

        switch (i){
            case 0:
                functionIcon.setImageResource(R.drawable.lay_icn_upquality);
                functionName.setText("本地音乐"+"");
                break;
            case 1:
                functionIcon.setImageResource(R.drawable.lay_icn_artist);
                functionName.setText("最近播放"+"");
                break;
            case 2:
                functionIcon.setImageResource(R.drawable.lay_icn_dld);
                functionName.setText("下载管理"+"");
                break;
            case 3:
                functionIcon.setImageResource(R.drawable.lay_icn_alb);
                functionName.setText("我的电台"+"");
                break;
            case 4:
                functionIcon.setImageResource(R.drawable.lay_icn_fav);
                functionName.setText("我的收藏"+"");
                break;
        }

        return view;
    }
}